package com.hualan.zhsq.controller.car;

import com.hualan.zhsq.entity.car.ParkingStatus;
import com.hualan.zhsq.service.car.ParkingStatusService;
import com.hualan.zhsq.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName ParkingStatusController
 * @Description 停车位状态controller
 * @Author ZheRan
 * @Date 2025年08月04日 下午7:06
 * @Version 1.0
 */
@RestController
public class ParkingStatusController {
    @Qualifier("parkingStatusService")
    @Autowired
    private ParkingStatusService parkingStatusService;

    //插入一条数据
    @PostMapping("/parkingStatus/add")
    public Result add(@RequestBody ParkingStatus parkingStatus) {
        return Result.success(parkingStatusService.add(parkingStatus));
    }

    //逻辑删除一条数据
    @DeleteMapping("/parkingStatus/remove/{id}")
    public Result remove(Integer id) {
        return Result.success(parkingStatusService.remove(id));
    }

    //批量逻辑删除数据
    @DeleteMapping("/parkingStatus/removeBatch")
    public Result removeBatch(Integer[] ids) {
        return Result.success(parkingStatusService.removeBatch(ids));
    }

    //修改一条数据
    @PutMapping("/parkingStatus/edit")
    public Result edit(@RequestBody ParkingStatus parkingStatus) {
        return Result.success(parkingStatusService.edit(parkingStatus));
    }

    //根据id查询数据
    @GetMapping("/parkingStatus/findById/{id}")
    public Result findById(@PathVariable Integer id) {
        return Result.success(parkingStatusService.findById(id));
    }

    //查询所有数据
    @GetMapping("/parkingStatus/findPage")
    private Result findPage() {
        return Result.success(parkingStatusService.findPage(1, 10, new ParkingStatus()));
    }

}
